/**
 * com.future CO.,ltd.
 */

package com.future.springcloud.controller;

import com.future.springcloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 类说明：
 */
@RestController
@RequestMapping(value = "/payment/hystrix")
public class PaymentHystrixController {

	@Resource
	private PaymentService paymentService;

	@Value("${server.port}")
	private String serverPort;

	/**
	 * 正常场景
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/ok/{id}")
	@ResponseBody
	public String paymentInfoOK(@PathVariable("id") Integer id) {
		return paymentService.paymentInfoOK(id);
	}

	/**
	 * 异常场景
	 *
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/timeout/{id}")
	@ResponseBody
	public String paymentInfoTimeOut(@PathVariable("id") Integer id) {
		return paymentService.paymentInfoTimeOut(id);
	}
}
